package com.lrs.java.spring.core.$01_helloworld;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class HelloWorldTest {

	@Test
	public void testHelloWorld() {

		// 1、读取配置文件实例化一个IoC容器
		ApplicationContext context = new ClassPathXmlApplicationContext(
				"com\\lrs\\java\\spring\\core\\$01_helloworld\\helloworld.xml");

		// 2、从容器中获取Bean，注意此处完全“面向接口编程，而不是面向实现”
		HelloApi helloApi = context.getBean("helloApi", HelloApi.class);

		// 3、执行业务逻辑
		helloApi.sayHello();
	}

}
